#include<bits/stdc++.h>
#define rep(U,V,W) for(int U=(V);U<=(W);U++)
using namespace std;
const int N=100005;
int n,r[N],t[N],f[N],cnt,ans,s;
int main(){
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	scanf("%d",&n);
    ans=n;
    rep(i,1,n) scanf("%d",&r[i]);
    sort(r+1,r+n+1);
    r[0]=-1;
    rep(i,1,n){
        if(r[i]-r[i-1]) cnt++;
        t[cnt]++;
        f[cnt]++;
    }
    rep(i,1,cnt) s+=f[i];
    rep(i,1,cnt-1){
		s-=f[i];
        if(s<=t[i]){
            printf("%d",ans-s);
            return 0;
        }
        s-=t[i];
        ans-=t[i];
        rep(op,i+1,n)
            if(f[op]>=t[i]){
                f[op]-=t[i];
                break;
            }else{
                t[i]-=f[op];
                f[op]=0;
            }
    }
    printf("%d",ans);
	return 0;
}
